package com.itheima.exerciseTest.method30_39.method32;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        DatagramSocket ds = new DatagramSocket();

        while (true){
            String str = sc.nextLine();
            byte[] bytes = str.getBytes();
            InetAddress byName = InetAddress.getByName("255.255.255.255"); // 192.168.23.34
            int port = 10000;
            DatagramPacket dp = new DatagramPacket(bytes,bytes.length,byName,port);
            ds.send(dp);

            if("886".equals(str)){
                System.out.println("关闭发送端");
                break;
            }
        }
        ds.close();
    }
}
